@model PostPagerModel
@inject IStringLocalizer<Resource> _localizer

@if (Model.Pager.Items.Any())
{
  @foreach (var post in Model.Pager.Items)
  {
    <article class="post-list d-flex">
      <figure class="post-list-cover">
        <img class="post-list-img" src="@PageHelper.CheckGetCoverrUrl(post.Cover)" alt="@post.Title">
      </figure>
      <section class="post-list-details">
        <h2 class="post-list-title">
          <a class="post-list-link" href="~/post/@post.Slug">@post.Title</a>
        </h2>
        <div class="post-list-meta d-flex">
          <div class="post-list-meta-item post-list-author">
            <img class="post-list-author-img" src="@PageHelper.CheckGetAvatarUrl(post.User.Avatar)" width="16" height="16"
                 alt="@post.User.NickName">
            <span class="post-list-author-name">@post.User.NickName</span>
          </div>
          <div class="post-list-meta-item post-list-date">
            <svg width="13" height="13" class="bi bi-calendar-event post-list-date-icon">
              <use xlink:href="/_content/@ThemesStandardConstant.AssemblyName/img/icon-sprites.svg#bi-calendar-event"></use>
            </svg>
            <time class="post-list-date-time">@DateTimeHelper.ToFriendlyShortDateString(post.PublishedAt)</time>
          </div>
          @if (post.Categories != null)
          {
            <div class="post-list-meta-item post-list-cat">
              <svg width="17" height="17" class="bi bi-hash post-list-cat-icon">
                <use xlink:href="/_content/@ThemesStandardConstant.AssemblyName/img/icon-sprites.svg#bi-hash"></use>
              </svg>
              @foreach (var cat in post.Categories)
              {
                <a class="post-list-cat-title" tabindex="-1" href="~/category/@cat.Content">@cat.Content</a>
              }
            </div>
          }
        </div>
        <p class="post-list-desc">@Html.Raw(post.Description)</p>
        <a class="post-list-more" href="~/post/@post.Slug" tabindex="-1">
          Read More
          <svg width="16" height="16" class="bi bi-arrow-right">
            <use xlink:href="/_content/@ThemesStandardConstant.AssemblyName/img/icon-sprites.svg#bi-arrow-right"></use>
          </svg>
        </a>
      </section>
    </article>
  }
}
else
{
  <div class="h1 text-capitalize">@_localizer["empty"]!</div>
}
